SET XACT_ABORT OFF
SET ARITHABORT OFF

/* DECLARE GLOBAL VARIABLES */
DECLARE @rptPK int
DECLARE @rptGroupPK int
DECLARE @tempPK int
DECLARE @errorcount int
DECLARE @dsql varchar(8000)
DECLARE @version decimal(9,2)

SELECT @version = CAST(REPLACE(LOWER(schema_version), 'sp', '') AS decimal(9,2)) FROM _schema

/* =====================================================
UPDATE REPORTS STYLES AND GROUP HEADERS - (ASListByCL_RC_772)
===================================================== */

IF @version >= 3.0 
BEGIN 
EXEC('PRINT ''Version 3.0 or greater detected. Importing Report Styles and Group Headers''
DECLARE @tempPK int
IF NOT EXISTS(SELECT ReportStyleName FROM ReportStyle WHERE ReportStyleName = ''Default'')
BEGIN 
INSERT INTO ReportStyle (ReportStyleName, ReportStyleDesc, ReportStyleCSS, IsDefault, IsBase, RowVersionIPAddress, RowVersionUserPK, RowVersionInitials, RowVersionAction, RowVersionDate) VALUES(''Default'', null, ''.pageselect{FONT-SIZE: 9pt; COLOR: #333333; FONT-FAMILY: Arial}
 .heading {background-color:#ffffff; CURSOR:HAND; FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: royalblue; FONT-FAMILY: Arial; z-index: 2500;} 
 .legendHeader {FONT-WEIGHT: bold; FONT-SIZE: 14px; COLOR: #333333; FONT-FAMILY: Arial}
 .normaltext {FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial}
 .labels {FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: royalblue; FONT-FAMILY: Arial}
 .assetUP {FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: green; FONT-FAMILY: Arial}
 .assetDOWN {FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #DD0000; FONT-FAMILY: Arial}
 .asset {FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial}
 .data {FONT-SIZE: 12px; COLOR: #494949; FONT-FAMILY: Arial}
 .data_underline {BORDER-RIGHT: medium none; BORDER-TOP: medium none; FONT-SIZE: 12px; BORDER-LEFT: medium none; COLOR: #494949; BORDER-BOTTOM: #333333 1px solid; FONT-FAMILY: Arial}
 .bottomline {BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: #333333 1px solid}
 .buttons {FONT-SIZE: 12px; WIDTH: 80px; CURSOR: hand; COLOR: #333333; FONT-FAMILY: Arial}
 .subtotal {BORDER-RIGHT: medium none; BORDER-TOP: #C0C0C0 1px solid; FONT-SIZE: 12px; BORDER-LEFT: medium none; COLOR: #333333; BORDER-BOTTOM: medium none; FONT-FAMILY: Arial}
 .bodyclasspreview {padding:15; scrollbar-base-color: #EAEAEA;}
 .bodyclasspreviewinwo {padding-right:15px; scrollbar-base-color: #EAEAEA;}
 .bodyclassprint {PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px}
 .bodyclassemail {PADDING-RIGHT: 15px; PADDING-LEFT: 15px; PADDING-BOTTOM: 20px; PADDING-TOP: 0px}
 .group1 {padding-left:0; FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial; FONT-WEIGHT: Bold; BACKGROUND-COLOR: #acc5e7}
 .group2 {padding-left:10; FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial; FONT-WEIGHT: Bold; BACKGROUND-COLOR: #c7d7ed}
 .group3 {padding-left:20; FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial; FONT-WEIGHT: Bold; BACKGROUND-COLOR: #dce8f4}
 .group4 {padding-left:30; FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial; FONT-WEIGHT: Bold; BACKGROUND-COLOR: #ecf1fb}
 .group5 {padding-left:40; FONT-SIZE: 12px; COLOR: royalblue; FONT-FAMILY: Arial; FONT-WEIGHT: Bold; BACKGROUND-COLOR: #ffffff}
 .groupheader {FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial; FONT-WEIGHT: Bold;}
 .normalright {BORDER-RIGHT: #c0c0c0 1px solid; BORDER-TOP: #c0c0c0 1px solid; PADDING-LEFT: 1px; FONT-WEIGHT: normal; FONT-SIZE: 8pt; MARGIN-BOTTOM: 1px; BORDER-LEFT: #c0c0c0 1px solid; COLOR: #000000; BORDER-BOTTOM: #c0c0c0 1px solid; FONT-FAMILY: Arial; BACKGROUND-COLOR: #ffffff; TEXT-ALIGN: right}
 TD.clsBtnUp {cursor: hand; color: black; font-weight: normal; border: outset #FFFFFF 2px;}
 TD.clsBtnDown {cursor: hand; color: black; font-weight: normal; border: inset #FFFFFF 2px;}
 TD.clsBtnOn {cursor: hand; color: black; font-weight: normal; border: inset #FFFFFF 2px;}
 TD.clsBtnOff {color: black; font-weight: normal; tab-index: 0; padding-top: 2px; padding-left: 2px; padding-right: 2px; padding-bottom: 2px; border: ;}
 INPUT {padding-left:3;}
 A:link {FONT-SIZE: 8pt; CURSOR: hand; COLOR: #315aad; FONT-FAMILY: Arial; BACKGROUND-COLOR: transparent;}
 A:visited {FONT-SIZE: 8pt; CURSOR: hand; COLOR: #315aad; FONT-FAMILY: Arial; BACKGROUND-COLOR: transparent;}
 A:active {FONT-SIZE: 8pt; CURSOR: hand; COLOR: #315aad; FONT-FAMILY: Arial; BACKGROUND-COLOR: transparent;}
 A:hover {COLOR: red;}
 fieldset {border:1 solid gray;}
 .buttonsdisabled { display: static; filter: Gray() Alpha(Opacity=40); cursor:;	}
 .buttonsenabled { display:	; filter: none; cursor:hand; }
 .normalrow {FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial }
 .tb {width:100%; PADDING-LEFT: 1px; FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial; border:1 solid gray;}
 .tbf {BACKGROUND-COLOR: #ffffcc; width:100%; PADDING-LEFT: 1px; FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial; border:1 solid gray;}
 .ta {width:200px; PADDING-LEFT: 1px; FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial; border:1 solid gray;}
 .taf {BACKGROUND-COLOR: #ffffcc; width:200px; PADDING-LEFT: 1px; FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial; border:1 solid gray;}
 .cb {COLOR: #333333;}
 .HeaderRight {font-family:Arial;font-size:16px;color:#333333;font-weight:bold}
 .SubHeaderRight {font-family:Arial;font-size:11px;font-weight:normal}
 .SRInstructions {margin-top:5px;font-family:Arial;font-size:8pt;color:green;font-weight:bold}
 .verticalcolumn {border:1 solid #CCCCCC;}
 .mcpagebreak {page-break-before: always;}
 .ReportRow1 {background-color:#FFFFFF; FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial }
 .ReportRow2 {background-color:#EFEFEF; FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial }
 .ReportRowCrit1 {background-color:#FFFFFF; FONT-SIZE: 8pt; COLOR: #333333; FONT-FAMILY: Arial }
 .ReportRowCrit2 {background-color:#EFEFEF; FONT-SIZE: 8pt; COLOR: #333333; FONT-FAMILY: Arial }
 .SmartRow {background-color:#FFDF84; FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial; cursor:hand; }
 .SubReportRow {background-color:#DEEFC6; FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Arial }'', 0, 1, '''', '''', ''_MC'', '''', getdate())
END 
')
END 
/* ============================================================
ReportID: ASListByCL_RC_772
Report Name: Asset Tree Hierarchy
============================================================ */

IF EXISTS (
SELECT ReportName FROM Reports WITH (NOLOCK)
WHERE ReportID = 'ASListByCL_RC_772')

BEGIN

PRINT '*******************************************************'
PRINT 'Report Exists - Updating...'
PRINT 'Report: Asset Tree Hierarchy'
PRINT '*******************************************************'

/* ================================================
UPDATE REPORT RECORDS - (ASListByCL_RC_772)
================================================ */
/* Set ReportPK for this Report */
SELECT @rptPK = ReportPK FROM Reports WITH (NOLOCK) WHERE ReportID='ASListByCL_RC_772'

/* Update Main Report Fields */
UPDATE Reports
SET	[ReportIDPriorToCopy]='ASListByCL', [ReportDesc]=null, [Sort1]=null, [Sort2]=null, [Sort3]=null, [Sort4]=null, [Sort5]=null, [Sort1DESC]=0, [Sort2DESC]=0, [Sort3DESC]=0, [Sort4DESC]=0, [Sort5DESC]=0, [Group1]=0, [Group2]=0, [Group3]=0, [Group4]=0, [Group5]=0, [Header1]=0, [Header2]=0, [Header3]=0, [Header4]=0, [Header5]=0, [GroupHeader1]=null, [GroupHeader2]=null, [GroupHeader3]=null, [GroupHeader4]=null, [GroupHeader5]=null, [Total1]=0, [Total2]=0, [Total3]=0, [Total4]=0, [Total5]=0, [Chart]=null, [ChartName]='Location', [ChartField]='AUTO_SORT1', [ChartSize]='L', [ReportFile]='rpt_generic1.asp', [FromSQL]='FROM Asset', [JoinSQL]='INNER JOIN fn_getAssetTreeOrder(1) fn_getAssetTreeOrder ON Asset.AssetPK = fn_getAssetTreeOrder.AssetPK Order By BinLoc', [WhereSQL]=null, [GroupBy]=0, [hits]=2, [Sequence]=0, [Layout]='hor', [VertCols]=1, [PageBreakEachRecord]=0, [Custom]=0, [ReportCopy]=0, [MCRegistrationDB]=0, [PrintCriteria]=1, [Active]=1, [UDFChar1]=null, [UDFChar2]=null, [UDFChar3]=null, [UDFChar4]=null, [UDFChar5]=null, [UDFDate1]=null, [UDFDate2]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionAction]='EDIT', [RowVersionDate]=getdate() , [ChartFunction]=null, [ChartFunctionField]=null, [NoDetail]=0, [PB1]=0, [PB2]=0, [PB3]=0, [PB4]=0, [PB5]=0, [SLDefault]=0, [SLType]=' ', [SLAction]='PW', [SLModuleID]='  ', [SLPKField]=null, [SLReportID]=null, [SLCustomAction]=null, [SLTooltip]=null, [SDDisplay]='     ', [SDModuleID]='  ', [SDPKField]=null, [SmartEmail]=0, [ChartPosition]=null, [ChartFormat]='I', [ChartSQL]=null, [Chart2]=null, [ChartName2]=null, [ChartField2]=null, [ChartSize2]=null, [ChartFormat2]=null, [ChartFunction2]=null, [ChartFunctionField2]=null, [ChartPosition2]=null, [ChartSQL2]=null, [Chart3]=null, [ChartName3]=null, [ChartField3]=null, [ChartSize3]=null, [ChartFormat3]=null, [ChartFunction3]=null, [ChartFunctionField3]=null, [ChartPosition3]=null, [ChartSQL3]=null, [ChartOnly]=0, [NoHeader]=0, [SRID1]=null, [SRPKField1]=null, [SRID2]=null, [SRPKField2]=null, [SRID3]=null, [SRPKField3]=null, [SRID4]=null, [SRPKField4]=null, [SRID5]=null, [SRPKField5]=null, [ReportPageSize]='Default', [ReportWidth]='100%', [PhotoCriteria]=1, [ReportStyleName]='Default', [UsedFor]='REPORTS', [SmartEmailLaborPK]=0, [SCDefault]='H', [SCField1]=null, [SCField2]=null, [SCField3]=null, [ReportStyleFontSize]=null, [ReportStyleFontColor]=null, [ReportStyleFontFamily]=null 
WHERE ReportPK = @rptPK
IF (@@error > 0) SET @errorcount = @errorcount + 1

IF @version >= 3.0 
BEGIN
SET @dSQL = 'UPDATE Reports SET [HavingSQL]=null, [DisplayPivotBar]=0, [DisplayColumnLines]=0, [DisplayTitleonPageBreak]=0, [DisplayFormatCriteria]=1, [R1T]='' '', [R1O]=null, [R1V1]=null, [R1V2]=null, [R1A]=0, [R1L]=0, [R1F]=0, [R1CS]=''border: #0066CC 2px solid;'', [R1AF]=''C'', [R2T]='' '', [R2O]=null, [R2V1]=null, [R2V2]=null, [R2A]=0, [R2L]=0, [R2F]=0, [R2CS]=''border: #0066CC 2px solid;'', [R2AF]=''C'', [R3T]='' '', [R3O]=null, [R3V1]=null, [R3V2]=null, [R3A]=0, [R3L]=0, [R3F]=0, [R3CS]=''border: #0066CC 2px solid;'', [R3AF]=''C'' WHERE ReportPK = ' + CAST(@rptPK AS varchar(20)) + '
'
EXEC(@dSQL)
IF (@@error > 0) SET @errorcount = @errorcount + 1

END

IF @version >= 4.2 
BEGIN
SET @dSQL = 'UPDATE Reports SET [DisplayDescription]=0 WHERE ReportPK = ' + CAST(@rptPK AS varchar(20)) + '
'
EXEC(@dSQL)
IF (@@error > 0) SET @errorcount = @errorcount + 1

END

PRINT 'Updating Report - ASListByCL_RC_772'

/* ==================================================
DELETE AND INSERT REPORT GROUPS - (ASListByCL_RC_772)
=================================================== */
DELETE FROM Report_ReportGroup WHERE ReportPK = @rptPK

PRINT 'Deleting Report_ReportGroup Rows - ASListByCL_RC_772'

IF (@@error > 0) SET @errorcount = @errorcount + 1

/* Make sure the report group actually exists */
IF NOT EXISTS (SELECT ReportGroupPK FROM ReportGroup WHERE ReportGroupPK = 12)
BEGIN
INSERT INTO ReportGroup ([ReportGroupID], [ReportGroupName], [ModuleID], [Sequence], [Icon], [RepairCenterPK], [IsUserGroup], [IsBatchGroup], [UDFChar1], [UDFChar2], [UDFChar3], [UDFChar4], [UDFChar5], [UDFDate1], [UDFDate2], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionAction], [RowVersionDate]) 
VALUES ('AS', 'Asset Reports', 'AS', 99, null, null, 0, 0, null, null, null, null, null, null, null, null, '', '', '_MC', 'CREATE', getdate())
PRINT 'Inserting ReportGroup Row - ' + 'Asset Reports'

IF (@@error > 0) SET @errorcount = @errorcount + 1

SET @rptGroupPK = @@IDENTITY
END
ELSE
BEGIN
UPDATE	ReportGroup
SET	[ReportGroupID]='AS', [ReportGroupName]='Asset Reports', [ModuleID]='AS', [Sequence]=99, [Icon]=null, [RepairCenterPK]=null, [IsUserGroup]=0, [IsBatchGroup]=0, [UDFChar1]=null, [UDFChar2]=null, [UDFChar3]=null, [UDFChar4]=null, [UDFChar5]=null, [UDFDate1]=null, [UDFDate2]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionAction]='EDIT', [RowVersionDate]=getdate()
WHERE	ReportGroupPK = 12
PRINT 'Updating ReportGroup Row - ' + 'Asset Reports'

SET @rptGroupPK = 12
END

IF (@@error > 0) SET @errorcount = @errorcount + 1

INSERT INTO Report_ReportGroup ([ReportPK], [ReportGroupPK], [DemoLaborPK], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, @rptGroupPK, '', '', '_MC', getdate())
PRINT 'Inserting Report_ReportGroup Row - ' + 'Asset Reports'
IF (@@error > 0) SET @errorcount = @errorcount + 1


/* ==================================================
DELETE AND INSERT REPORT TABLES - (ASListByCL_RC_772)
=================================================== */
DELETE FROM ReportTables WHERE ReportPK = @rptPK

PRINT 'Deleting ReportTables Rows - ASListByCL_RC_772'
IF (@@error > 0) SET @errorcount = @errorcount + 1

INSERT INTO ReportTables ([ReportPK], [RFTable], [Alias], [DisplayOrder], [LabelOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'Asset', null, 0, null, null, '', '', '_MC', getdate())
PRINT 'Inserting ReportTables Row - Asset'
IF (@@error > 0) SET @errorcount = @errorcount + 1

INSERT INTO ReportTables ([ReportPK], [RFTable], [Alias], [DisplayOrder], [LabelOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'AssetHierarchy', null, 0, null, null, '', '', '_MC', getdate())
PRINT 'Inserting ReportTables Row - AssetHierarchy'
IF (@@error > 0) SET @errorcount = @errorcount + 1


/* ==================================================
UPDATE OR INSERT REPORT CRITERIA - (ASListByCL_RC_772)
=================================================== */	
/* ==================================================
UPDATE OR INSERT REPORT FIELDS - (ASListByCL_RC_772)
=================================================== */	
IF EXISTS (
SELECT ReportFieldPK FROM ReportFields WITH (NOLOCK) WHERE ReportPK = @rptPK AND RFTable = 'Asset' AND RFField = 'Icon')
BEGIN
SELECT @tempPK = ReportFieldPK FROM ReportFields WITH (NOLOCK) WHERE ReportPK = @rptPK AND RFTable = 'Asset' AND RFField = 'Icon'
UPDATE ReportFields
SET [ReportPK]=@rptPK, [DataDictPK]=2112, [AGFunction]=null, [Alias]=null, [DisplayOrder]=0, [Display]=1, [NotUserSelectable]=0, [LabelOverride]=null, [TotalIfSelected]=0, [BlankLineIfSelected]=0, [UseCustomExpression]=0, [CustomExpression]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionDate]=getdate(), [SLAction]=null, [SLModuleID]=null, [SLPKField]=null, [SLReportID]=null, [SLCustomAction]=null, [SLToolTip]=null 
WHERE [ReportPK]=@rptPK AND [RFTable]='Asset' AND [RFField]='Icon'
IF (@@error > 0) SET @errorcount = @errorcount + 1

PRINT 'Updating ReportFields Row - Asset.Icon'
END
ELSE
BEGIN
INSERT INTO ReportFields ([ReportPK], [DataDictPK], [AGFunction], [RFTable], [RFField], [Alias], [DisplayOrder], [Display], [NotUserSelectable], [LabelOverride], [TotalIfSelected], [BlankLineIfSelected], [UseCustomExpression], [CustomExpression], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip])
VALUES(@rptPK, 2112, null, 'Asset', 'Icon', null, 0, 1, 0, null, 0, 0, 0, null, null, '', '', '_MC', getdate(), null, null, null, null, null, null)
PRINT 'Inserting ReportFields Row - Asset.Icon'
IF (@@error > 0) 
BEGIN
SET @errorcount = @errorcount + 1
SET @tempPK = -1
END
ELSE
BEGIN
SET @tempPK = @@IDENTITY
END
END

IF @version >= 4.2 
BEGIN
SET @dSQL = 'UPDATE ReportFields SET [Alignment] = null, [AdditionalWidth] = null, [PivotSetup] = null, [AddPivotColumnsWithNoDataFrom] = null, [AddPivotColumnsWithNoDataFromCustom] = null, [Data_Type_Override] = null, [ColumnFormat] = null, [ColumnCS] = null, [GroupByCustomExpression] = 1 WHERE ReportFieldPK = ' + CAST(@tempPK AS varchar(20)) + '
'
EXEC(@dSQL)
IF (@@error > 0) SET @errorcount = @errorcount + 1
END
IF EXISTS (
SELECT ReportFieldPK FROM ReportFields WITH (NOLOCK) WHERE ReportPK = @rptPK AND RFTable = 'Asset' AND RFField = 'AssetName')
BEGIN
SELECT @tempPK = ReportFieldPK FROM ReportFields WITH (NOLOCK) WHERE ReportPK = @rptPK AND RFTable = 'Asset' AND RFField = 'AssetName'
UPDATE ReportFields
SET [ReportPK]=@rptPK, [DataDictPK]=2108, [AGFunction]=null, [Alias]=null, [DisplayOrder]=1, [Display]=1, [NotUserSelectable]=0, [LabelOverride]=null, [TotalIfSelected]=0, [BlankLineIfSelected]=0, [UseCustomExpression]=0, [CustomExpression]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionDate]=getdate(), [SLAction]=null, [SLModuleID]=null, [SLPKField]=null, [SLReportID]=null, [SLCustomAction]=null, [SLToolTip]=null 
WHERE [ReportPK]=@rptPK AND [RFTable]='Asset' AND [RFField]='AssetName'
IF (@@error > 0) SET @errorcount = @errorcount + 1

PRINT 'Updating ReportFields Row - Asset.AssetName'
END
ELSE
BEGIN
INSERT INTO ReportFields ([ReportPK], [DataDictPK], [AGFunction], [RFTable], [RFField], [Alias], [DisplayOrder], [Display], [NotUserSelectable], [LabelOverride], [TotalIfSelected], [BlankLineIfSelected], [UseCustomExpression], [CustomExpression], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip])
VALUES(@rptPK, 2108, null, 'Asset', 'AssetName', null, 1, 1, 0, null, 0, 0, 0, null, null, '', '', '_MC', getdate(), null, null, null, null, null, null)
PRINT 'Inserting ReportFields Row - Asset.AssetName'
IF (@@error > 0) 
BEGIN
SET @errorcount = @errorcount + 1
SET @tempPK = -1
END
ELSE
BEGIN
SET @tempPK = @@IDENTITY
END
END

IF @version >= 4.2 
BEGIN
SET @dSQL = 'UPDATE ReportFields SET [Alignment] = null, [AdditionalWidth] = null, [PivotSetup] = null, [AddPivotColumnsWithNoDataFrom] = null, [AddPivotColumnsWithNoDataFromCustom] = null, [Data_Type_Override] = null, [ColumnFormat] = null, [ColumnCS] = null, [GroupByCustomExpression] = 1 WHERE ReportFieldPK = ' + CAST(@tempPK AS varchar(20)) + '
'
EXEC(@dSQL)
IF (@@error > 0) SET @errorcount = @errorcount + 1
END
IF EXISTS (
SELECT ReportFieldPK FROM ReportFields WITH (NOLOCK) WHERE ReportPK = @rptPK AND RFTable = 'Asset' AND RFField = 'ClassificationName')
BEGIN
SELECT @tempPK = ReportFieldPK FROM ReportFields WITH (NOLOCK) WHERE ReportPK = @rptPK AND RFTable = 'Asset' AND RFField = 'ClassificationName'
UPDATE ReportFields
SET [ReportPK]=@rptPK, [DataDictPK]=4398, [AGFunction]=null, [Alias]=null, [DisplayOrder]=3, [Display]=1, [NotUserSelectable]=0, [LabelOverride]=null, [TotalIfSelected]=0, [BlankLineIfSelected]=0, [UseCustomExpression]=0, [CustomExpression]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionDate]=getdate(), [SLAction]=null, [SLModuleID]=null, [SLPKField]=null, [SLReportID]=null, [SLCustomAction]=null, [SLToolTip]=null 
WHERE [ReportPK]=@rptPK AND [RFTable]='Asset' AND [RFField]='ClassificationName'
IF (@@error > 0) SET @errorcount = @errorcount + 1

PRINT 'Updating ReportFields Row - Asset.ClassificationName'
END
ELSE
BEGIN
INSERT INTO ReportFields ([ReportPK], [DataDictPK], [AGFunction], [RFTable], [RFField], [Alias], [DisplayOrder], [Display], [NotUserSelectable], [LabelOverride], [TotalIfSelected], [BlankLineIfSelected], [UseCustomExpression], [CustomExpression], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip])
VALUES(@rptPK, 4398, null, 'Asset', 'ClassificationName', null, 3, 1, 0, null, 0, 0, 0, null, null, '', '', '_MC', getdate(), null, null, null, null, null, null)
PRINT 'Inserting ReportFields Row - Asset.ClassificationName'
IF (@@error > 0) 
BEGIN
SET @errorcount = @errorcount + 1
SET @tempPK = -1
END
ELSE
BEGIN
SET @tempPK = @@IDENTITY
END
END

IF @version >= 4.2 
BEGIN
SET @dSQL = 'UPDATE ReportFields SET [Alignment] = null, [AdditionalWidth] = null, [PivotSetup] = null, [AddPivotColumnsWithNoDataFrom] = null, [AddPivotColumnsWithNoDataFromCustom] = null, [Data_Type_Override] = null, [ColumnFormat] = null, [ColumnCS] = null, [GroupByCustomExpression] = 1 WHERE ReportFieldPK = ' + CAST(@tempPK AS varchar(20)) + '
'
EXEC(@dSQL)
IF (@@error > 0) SET @errorcount = @errorcount + 1
END
IF EXISTS (
SELECT ReportFieldPK FROM ReportFields WITH (NOLOCK) WHERE ReportPK = @rptPK AND RFTable = 'Asset' AND RFField = 'AssetID')
BEGIN
SELECT @tempPK = ReportFieldPK FROM ReportFields WITH (NOLOCK) WHERE ReportPK = @rptPK AND RFTable = 'Asset' AND RFField = 'AssetID'
UPDATE ReportFields
SET [ReportPK]=@rptPK, [DataDictPK]=2107, [AGFunction]=null, [Alias]=null, [DisplayOrder]=2, [Display]=1, [NotUserSelectable]=0, [LabelOverride]=null, [TotalIfSelected]=0, [BlankLineIfSelected]=0, [UseCustomExpression]=1, [CustomExpression]='REPLICATE(''&nbsp;'', lvl*5) + Asset.AssetID', [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionDate]=getdate(), [SLAction]='  ', [SLModuleID]=null, [SLPKField]=null, [SLReportID]=null, [SLCustomAction]=null, [SLToolTip]=null 
WHERE [ReportPK]=@rptPK AND [RFTable]='Asset' AND [RFField]='AssetID'
IF (@@error > 0) SET @errorcount = @errorcount + 1

PRINT 'Updating ReportFields Row - Asset.AssetID'
END
ELSE
BEGIN
INSERT INTO ReportFields ([ReportPK], [DataDictPK], [AGFunction], [RFTable], [RFField], [Alias], [DisplayOrder], [Display], [NotUserSelectable], [LabelOverride], [TotalIfSelected], [BlankLineIfSelected], [UseCustomExpression], [CustomExpression], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip])
VALUES(@rptPK, 2107, null, 'Asset', 'AssetID', null, 2, 1, 0, null, 0, 0, 1, 'REPLICATE(''&nbsp;'', lvl*5) + Asset.AssetID', null, '', '', '_MC', getdate(), '  ', null, null, null, null, null)
PRINT 'Inserting ReportFields Row - Asset.AssetID'
IF (@@error > 0) 
BEGIN
SET @errorcount = @errorcount + 1
SET @tempPK = -1
END
ELSE
BEGIN
SET @tempPK = @@IDENTITY
END
END

IF @version >= 4.2 
BEGIN
SET @dSQL = 'UPDATE ReportFields SET [Alignment] = null, [AdditionalWidth] = null, [PivotSetup] = ''  '', [AddPivotColumnsWithNoDataFrom] = null, [AddPivotColumnsWithNoDataFromCustom] = null, [Data_Type_Override] = null, [ColumnFormat] = null, [ColumnCS] = null, [GroupByCustomExpression] = 1 WHERE ReportFieldPK = ' + CAST(@tempPK AS varchar(20)) + '
'
EXEC(@dSQL)
IF (@@error > 0) SET @errorcount = @errorcount + 1
END
/* =====================================================
UPDATE REPORTS COLS IN DATA DICT - (ASListByCL_RC_772)
===================================================== */
UPDATE DataDict 
SET	[REPORT_NOSELECT]=null, [REPORT_EDIT]='TB', [REPORT_LABEL]=null, [TOTALIFSELECTED]=0 
WHERE	TABLE_NAME = 'Asset' AND COLUMN_NAME = 'AssetID' 

PRINT 'Updating DataDict Row - Asset.AssetID'
IF (@@error > 0) SET @errorcount = @errorcount + 1

UPDATE DataDict 
SET	[REPORT_NOSELECT]=null, [REPORT_EDIT]='TB', [REPORT_LABEL]=null, [TOTALIFSELECTED]=0 
WHERE	TABLE_NAME = 'Asset' AND COLUMN_NAME = 'AssetName' 

PRINT 'Updating DataDict Row - Asset.AssetName'
IF (@@error > 0) SET @errorcount = @errorcount + 1

UPDATE DataDict 
SET	[REPORT_NOSELECT]=null, [REPORT_EDIT]='TB', [REPORT_LABEL]=null, [TOTALIFSELECTED]=0 
WHERE	TABLE_NAME = 'Asset' AND COLUMN_NAME = 'ClassificationName' 

PRINT 'Updating DataDict Row - Asset.ClassificationName'
IF (@@error > 0) SET @errorcount = @errorcount + 1

UPDATE DataDict 
SET	[REPORT_NOSELECT]=null, [REPORT_EDIT]='TB', [REPORT_LABEL]=null, [TOTALIFSELECTED]=0 
WHERE	TABLE_NAME = 'Asset' AND COLUMN_NAME = 'Icon' 

PRINT 'Updating DataDict Row - Asset.Icon'
IF (@@error > 0) SET @errorcount = @errorcount + 1

END
/* REPORT DID NOT EXIST, CREATE ALL RECORDS */
ELSE

BEGIN
PRINT '*******************************************************'
PRINT 'Report Does Not Exist - Inserting...'
PRINT 'Report: Asset Tree Hierarchy'
PRINT '*******************************************************'

/* =====================================================
INSERT REPORT RECORDS - (ASListByCL_RC_772)
===================================================== */
/* INSERT Main Report */
INSERT INTO Reports ([ReportIDPriorToCopy], [ReportID], [ReportName], [ReportDesc], [RepairCenterPK], [Sort1], [Sort2], [Sort3], [Sort4], [Sort5], [Sort1DESC], [Sort2DESC], [Sort3DESC], [Sort4DESC], [Sort5DESC], [Group1], [Group2], [Group3], [Group4], [Group5], [Header1], [Header2], [Header3], [Header4], [Header5], [GroupHeader1], [GroupHeader2], [GroupHeader3], [GroupHeader4], [GroupHeader5], [Total1], [Total2], [Total3], [Total4], [Total5], [Chart], [ChartName], [ChartField], [ChartSize], [ReportFile], [FromSQL], [JoinSQL], [WhereSQL], [GroupBy], [hits], [Sequence], [Layout], [VertCols], [PageBreakEachRecord], [Custom], [ReportCopy], [MCRegistrationDB], [PrintCriteria], [Active], [UDFChar1], [UDFChar2], [UDFChar3], [UDFChar4], [UDFChar5], [UDFDate1], [UDFDate2], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionAction], [RowVersionDate], [ChartFunction], [ChartFunctionField], [NoDetail], [PB1], [PB2], [PB3], [PB4], [PB5], [SLDefault], [SLType], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip], [SDDisplay], [SDModuleID], [SDPKField], [SmartEmail], [ChartPosition], [ChartFormat], [ChartSQL], [Chart2], [ChartName2], [ChartField2], [ChartSize2], [ChartFormat2], [ChartFunction2], [ChartFunctionField2], [ChartPosition2], [ChartSQL2], [Chart3], [ChartName3], [ChartField3], [ChartSize3], [ChartFormat3], [ChartFunction3], [ChartFunctionField3], [ChartPosition3], [ChartSQL3], [ChartOnly], [NoHeader], [HavingSQL], [SRID1], [SRPKField1], [SRID2], [SRPKField2], [SRID3], [SRPKField3], [SRID4], [SRPKField4], [SRID5], [SRPKField5], [ReportPageSize], [ReportWidth], [PhotoCriteria], [ReportStyleName], [UsedFor], [SmartEmailLaborPK], [SCDefault], [SCField1], [SCField2], [SCField3], [ReportStyleFontSize], [ReportStyleFontColor], [ReportStyleFontFamily] )
VALUES('ASListByCL', 'ASListByCL_RC_772', 'Asset Tree Hierarchy', null, null, null, null, null, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, null, null, null, null, 0, 0, 0, 0, 0, null, 'Location', 'AUTO_SORT1', 'L', 'rpt_generic1.asp', 'FROM Asset', 'INNER JOIN fn_getAssetTreeOrder(1) fn_getAssetTreeOrder ON Asset.AssetPK = fn_getAssetTreeOrder.AssetPK Order By BinLoc', null, 0, 0, 0, 'hor', 1, 0, 0, 0, 0, 1, 1, null, null, null, null, null, null, null, null, '', '', '_MC', 'CREATE', getdate(), null, null, 0, 0, 0, 0, 0, 0, 0, ' ', 'PW', '  ', null, null, null, null, '     ', '  ', null, 0, null, 'I', null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, 0, null, null, null, null, null, null, null, null, null, null, null, 'Default', '100%', 1, 'Default', 'REPORTS', 0, 'H', null, null, null, null, null, null)

PRINT 'Inserting Report - ASListByCL_RC_772'
IF (@@error > 0) SET @errorcount = @errorcount + 1

SET @rptPK = @@Identity

IF @version >= 3.0 
BEGIN
SET @dSQL = 'UPDATE Reports SET [HavingSQL]=null, [DisplayPivotBar]=0, [DisplayColumnLines]=0, [DisplayTitleonPageBreak]=0, [DisplayFormatCriteria]=1, [R1T]='' '', [R1O]=null, [R1V1]=null, [R1V2]=null, [R1A]=0, [R1L]=0, [R1F]=0, [R1CS]=''border: #0066CC 2px solid;'', [R1AF]=''C'', [R2T]='' '', [R2O]=null, [R2V1]=null, [R2V2]=null, [R2A]=0, [R2L]=0, [R2F]=0, [R2CS]=''border: #0066CC 2px solid;'', [R2AF]=''C'', [R3T]='' '', [R3O]=null, [R3V1]=null, [R3V2]=null, [R3A]=0, [R3L]=0, [R3F]=0, [R3CS]=''border: #0066CC 2px solid;'', [R3AF]=''C'' WHERE ReportPK = ' + CAST(@rptPK AS varchar(20)) + '
'
EXEC(@dSQL)
IF (@@error > 0) SET @errorcount = @errorcount + 1

END

IF @version >= 4.2 
BEGIN
SET @dSQL = 'UPDATE Reports SET [DisplayDescription]=0 WHERE ReportPK = ' + CAST(@rptPK AS varchar(20)) + '
'
EXEC(@dSQL)
IF (@@error > 0) SET @errorcount = @errorcount + 1

END

/* ==================================================
UPDATE OR INSERT REPORT GROUPS - (ASListByCL_RC_772)
=================================================== */

/* Make sure the report group actually exists */
IF NOT EXISTS (SELECT ReportGroupPK FROM ReportGroup WHERE ReportGroupPK = 12)
BEGIN
INSERT INTO ReportGroup ([ReportGroupID], [ReportGroupName], [ModuleID], [Sequence], [Icon], [RepairCenterPK], [IsUserGroup], [IsBatchGroup], [UDFChar1], [UDFChar2], [UDFChar3], [UDFChar4], [UDFChar5], [UDFDate1], [UDFDate2], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionAction], [RowVersionDate]) 
VALUES ('AS', 'Asset Reports', 'AS', 99, null, null, 0, 0, null, null, null, null, null, null, null, null, '', '', '_MC', 'CREATE', getdate())
IF (@@error > 0) SET @errorcount = @errorcount + 1

PRINT 'Inserting ReportGroup Row - ' + 'Asset Reports'

SET @rptGroupPK = @@IDENTITY
END
ELSE
BEGIN
UPDATE	ReportGroup
SET	[ReportGroupID]='AS', [ReportGroupName]='Asset Reports', [ModuleID]='AS', [Sequence]=99, [Icon]=null, [RepairCenterPK]=null, [IsUserGroup]=0, [IsBatchGroup]=0, [UDFChar1]=null, [UDFChar2]=null, [UDFChar3]=null, [UDFChar4]=null, [UDFChar5]=null, [UDFDate1]=null, [UDFDate2]=null, [DemoLaborPK]=null, [RowVersionIPAddress]='', [RowVersionUserPK]='', [RowVersionInitials]='_MC', [RowVersionAction]='EDIT', [RowVersionDate]=getdate()
WHERE	ReportGroupPK = 12
IF (@@error > 0) SET @errorcount = @errorcount + 1

PRINT 'Updating ReportGroup Row - ' + 'Asset Reports'

SET @rptGroupPK = 12
END

INSERT INTO Report_ReportGroup ([ReportPK], [ReportGroupPK], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, @rptGroupPK, null, '', '', '_MC', getdate())
PRINT 'Inserting Report_ReportGroup Row - ' + 'Asset Reports'
IF (@@error > 0) SET @errorcount = @errorcount + 1

/* ==================================================
INSERT REPORT TABLES- (ASListByCL_RC_772)
=================================================== */	
INSERT INTO ReportTables ([ReportPK], [RFTable], [Alias], [DisplayOrder], [LabelOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'Asset', null, 0, null, null, '', '', '_MC', getdate())
PRINT 'Inserting ReportTables Row - Asset'
IF (@@error > 0) SET @errorcount = @errorcount + 1

INSERT INTO ReportTables ([ReportPK], [RFTable], [Alias], [DisplayOrder], [LabelOverride], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate]) VALUES (@rptPK, 'AssetHierarchy', null, 0, null, null, '', '', '_MC', getdate())
PRINT 'Inserting ReportTables Row - AssetHierarchy'
IF (@@error > 0) SET @errorcount = @errorcount + 1


/* ==================================================
INSERT REPORT CRITERIA - (ASListByCL_RC_772)
=================================================== */	
/* ==================================================
INSERT REPORT FIELDS - (ASListByCL_RC_772)
=================================================== */	
INSERT INTO ReportFields ([ReportPK], [DataDictPK], [AGFunction], [RFTable], [RFField], [Alias], [DisplayOrder], [Display], [NotUserSelectable], [LabelOverride], [TotalIfSelected], [BlankLineIfSelected], [UseCustomExpression], [CustomExpression], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip])
VALUES(@rptPK, 2112, null, 'Asset', 'Icon', null, 0, 1, 0, null, 0, 0, 0, null, null, '', '', '_MC', getdate(), null, null, null, null, null, null)
PRINT 'Inserting ReportFields Row - Asset.Icon'
IF (@@error > 0) SET @errorcount = @errorcount + 1

IF @version >= 4.2 
BEGIN
SET @tempPK = @@IDENTITY
SET @dSQL = 'UPDATE ReportFields SET [Alignment] = null, [AdditionalWidth] = null, [PivotSetup] = null, [AddPivotColumnsWithNoDataFrom] = null, [AddPivotColumnsWithNoDataFromCustom] = null, [Data_Type_Override] = null, [ColumnFormat] = null, [ColumnCS] = null, [GroupByCustomExpression] = 1 WHERE ReportFieldPK = ' + CAST(@tempPK AS varchar(20)) + '
'
EXEC(@dSQL)
IF (@@error > 0) SET @errorcount = @errorcount + 1
END
INSERT INTO ReportFields ([ReportPK], [DataDictPK], [AGFunction], [RFTable], [RFField], [Alias], [DisplayOrder], [Display], [NotUserSelectable], [LabelOverride], [TotalIfSelected], [BlankLineIfSelected], [UseCustomExpression], [CustomExpression], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip])
VALUES(@rptPK, 2108, null, 'Asset', 'AssetName', null, 1, 1, 0, null, 0, 0, 0, null, null, '', '', '_MC', getdate(), null, null, null, null, null, null)
PRINT 'Inserting ReportFields Row - Asset.AssetName'
IF (@@error > 0) SET @errorcount = @errorcount + 1

IF @version >= 4.2 
BEGIN
SET @tempPK = @@IDENTITY
SET @dSQL = 'UPDATE ReportFields SET [Alignment] = null, [AdditionalWidth] = null, [PivotSetup] = null, [AddPivotColumnsWithNoDataFrom] = null, [AddPivotColumnsWithNoDataFromCustom] = null, [Data_Type_Override] = null, [ColumnFormat] = null, [ColumnCS] = null, [GroupByCustomExpression] = 1 WHERE ReportFieldPK = ' + CAST(@tempPK AS varchar(20)) + '
'
EXEC(@dSQL)
IF (@@error > 0) SET @errorcount = @errorcount + 1
END
INSERT INTO ReportFields ([ReportPK], [DataDictPK], [AGFunction], [RFTable], [RFField], [Alias], [DisplayOrder], [Display], [NotUserSelectable], [LabelOverride], [TotalIfSelected], [BlankLineIfSelected], [UseCustomExpression], [CustomExpression], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip])
VALUES(@rptPK, 4398, null, 'Asset', 'ClassificationName', null, 3, 1, 0, null, 0, 0, 0, null, null, '', '', '_MC', getdate(), null, null, null, null, null, null)
PRINT 'Inserting ReportFields Row - Asset.ClassificationName'
IF (@@error > 0) SET @errorcount = @errorcount + 1

IF @version >= 4.2 
BEGIN
SET @tempPK = @@IDENTITY
SET @dSQL = 'UPDATE ReportFields SET [Alignment] = null, [AdditionalWidth] = null, [PivotSetup] = null, [AddPivotColumnsWithNoDataFrom] = null, [AddPivotColumnsWithNoDataFromCustom] = null, [Data_Type_Override] = null, [ColumnFormat] = null, [ColumnCS] = null, [GroupByCustomExpression] = 1 WHERE ReportFieldPK = ' + CAST(@tempPK AS varchar(20)) + '
'
EXEC(@dSQL)
IF (@@error > 0) SET @errorcount = @errorcount + 1
END
INSERT INTO ReportFields ([ReportPK], [DataDictPK], [AGFunction], [RFTable], [RFField], [Alias], [DisplayOrder], [Display], [NotUserSelectable], [LabelOverride], [TotalIfSelected], [BlankLineIfSelected], [UseCustomExpression], [CustomExpression], [DemoLaborPK], [RowVersionIPAddress], [RowVersionUserPK], [RowVersionInitials], [RowVersionDate], [SLAction], [SLModuleID], [SLPKField], [SLReportID], [SLCustomAction], [SLTooltip])
VALUES(@rptPK, 2107, null, 'Asset', 'AssetID', null, 2, 1, 0, null, 0, 0, 1, 'REPLICATE(''&nbsp;'', lvl*5) + Asset.AssetID', null, '', '', '_MC', getdate(), '  ', null, null, null, null, null)
PRINT 'Inserting ReportFields Row - Asset.AssetID'
IF (@@error > 0) SET @errorcount = @errorcount + 1

IF @version >= 4.2 
BEGIN
SET @tempPK = @@IDENTITY
SET @dSQL = 'UPDATE ReportFields SET [Alignment] = null, [AdditionalWidth] = null, [PivotSetup] = ''  '', [AddPivotColumnsWithNoDataFrom] = null, [AddPivotColumnsWithNoDataFromCustom] = null, [Data_Type_Override] = null, [ColumnFormat] = null, [ColumnCS] = null, [GroupByCustomExpression] = 1 WHERE ReportFieldPK = ' + CAST(@tempPK AS varchar(20)) + '
'
EXEC(@dSQL)
IF (@@error > 0) SET @errorcount = @errorcount + 1
END
/* =====================================================
UPDATE REPORTS COLS IN DATA DICT - (ASListByCL_RC_772)
===================================================== */

UPDATE DataDict 
SET	[REPORT_NOSELECT]=null, [REPORT_EDIT]='TB', [REPORT_LABEL]=null, [TOTALIFSELECTED]=0 
WHERE	TABLE_NAME = 'Asset' AND COLUMN_NAME = 'AssetID' 

PRINT 'Updating DataDict Row - Asset.AssetID'
if (@@error > 0) Set @errorcount = @errorcount + 1

UPDATE DataDict 
SET	[REPORT_NOSELECT]=null, [REPORT_EDIT]='TB', [REPORT_LABEL]=null, [TOTALIFSELECTED]=0 
WHERE	TABLE_NAME = 'Asset' AND COLUMN_NAME = 'AssetName' 

PRINT 'Updating DataDict Row - Asset.AssetName'
if (@@error > 0) Set @errorcount = @errorcount + 1

UPDATE DataDict 
SET	[REPORT_NOSELECT]=null, [REPORT_EDIT]='TB', [REPORT_LABEL]=null, [TOTALIFSELECTED]=0 
WHERE	TABLE_NAME = 'Asset' AND COLUMN_NAME = 'ClassificationName' 

PRINT 'Updating DataDict Row - Asset.ClassificationName'
if (@@error > 0) Set @errorcount = @errorcount + 1

UPDATE DataDict 
SET	[REPORT_NOSELECT]=null, [REPORT_EDIT]='TB', [REPORT_LABEL]=null, [TOTALIFSELECTED]=0 
WHERE	TABLE_NAME = 'Asset' AND COLUMN_NAME = 'Icon' 

PRINT 'Updating DataDict Row - Asset.Icon'
if (@@error > 0) Set @errorcount = @errorcount + 1

END

PRINT '*******************************************************'
IF (@errorcount > 0) PRINT @errorcount + ' Error(s) Occurred: ASListByCL_RC_772'
ELSE PRINT 'No Errors Occurred: ASListByCL_RC_772'

